<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Index_Index_module extends CI_Module {

    private $data;

    function __construct()
    {
        parent::__construct();
        $this->data['nav_list'] = $this->_navigation_list();
    }

    public function index()
    {
        $this->data['params'] = $this->_seo_array(NULL,NULL,NULL,$high_nav='home');
        $this->load->view('index/index',$this->data);
    }

    public function _navigation_list()
    {
        $navigation = array(
            array('name'=>'首页','url'=>site_url('index/index/index'),'nav'=>'home'),
            array('name'=>'关于','url'=>site_url('index/index/about'),'nav'=>'about'),
            array('name'=>'联系我们','url'=>site_url('index/index/contactus'),'nav'=>'contactus'),
            array('name'=>'文档','url'=>site_url('index/index/document'),'nav'=>'document'),
            array('name'=>'产品','url'=>site_url('index/index/product'),'nav'=>'product'),
            array('name'=>'新闻','url'=>site_url('index/index/news'),'nav'=>'news')
        );
        return $navigation;
    }

    public function _seo_array($title = '',$keywords = '',$description = '',$high_nav = '')
    {
        $return = array(
            'seo'=>array(
                'title'=>$title,
                'keywords'=>$keywords,
                'description'=>$description,
            ),
            'high_nav'=>$high_nav
        );
        return $return ;
    }

    public function head($params=array())
    {
        $params['nav_list'] = $this->_navigation_list();
       $this->load->view('index/public/page_header',$params);
    }

    public function foot($params=array())
    {
        $this->load->view('index/public/page_footer',$params);
    }

    public function about()
    {
        $this->data['params'] = $this->_seo_array(NULL,NULL,NULL,$high_nav='about');
        $this->load->view('index/about',$this->data);
    }

    public function contactus()
    {
        $this->data['params'] = $this->_seo_array(NULL,NULL,NULL,$high_nav='contactus');
        $this->load->view('index/contactus',$this->data);
    }

    public function document()
    {
        $this->data['params'] = $this->_seo_array(NULL,NULL,NULL,$high_nav='document');
        $this->load->view('index/document',$this->data);
    }

    public function product()
    {
        $this->data['params'] = $this->_seo_array(NULL,NULL,NULL,$high_nav='product');
        $this->load->view('index/product',$this->data);
    }

    public function news()
    {
        $this->data['params'] = $this->_seo_array(NULL,NULL,NULL,$high_nav='high_nav');
        $this->load->view('index/news',$this->data);
    }

}